from Test_Case.order_case import Order_cases
from Test_Case.customer_case import Customer_cases
import xlrd
class Test_all:
    def test_all_order(self):
        book = xlrd.open_workbook(r'..\Data\Test_Data.xlsx')
        s = book.sheets()[3]
        with open(r'..\Data\interface_test_report.txt','a',encoding='utf-8') as f:
            for i in range(1,s.nrows):
                line = s.row_values(i)
                print(line)
                if i <5:
                    x = Order_cases().order_cases(line[6],line[7],line[8],line[9],line[10])
                    if  x == line[5]:
                        print('验证发货点成功')
                        f.write('%s,%s,%s,%s,%s,%s,%s' % (line[0], line[1], line[2], line[3], line[5], x, '用例通过\n'))
                    else:
                        print('验证发货点失败')
                        f.write('%s,%s,%s,%s,%s,%s,%s'%(line[0],line[1],line[2],line[3],line[5],x ,'用例未通过\n'))
                    # print(x)
                else:
                    y = Customer_cases().customer_cases(line[6], line[7], line[8], line[9], line[10],line[11],line[12],line[13])
                    if y == line[5]:
                        print('验证会员成功')
                        f.write('%s,%s,%s,%s,%s,%s,%s' % (line[0], line[1], line[2], line[3], line[5], y, '用例通过\n'))
                    else:
                        print('验证会员失败')
                        f.write('%s,%s,%s,%s,%s,%s,%s' % (line[0], line[1], line[2], line[3], line[5], y, '用例未通过\n'))
                    # print(y)
# Test_all().test_all_order()



